
How to use these routines for Software Protection
-------------------------------------------------

This directory contains all the code required to incorporate the
'Acorn Approved Software Protection Scheme' into any
program/application.

The code cannot be added directly to your application, it must first
be compiled, in the correct sequence, then linked into your own
application.

Makefiles are provided which can be used with !Make or Amu.


Directory Contents
------------------

1) !!ReadMe    - This ReadMe file.

2) !InitMDisc  - A program to initialise any ADFS E type floppy disc into
                 a special master disc. It also creates the specially
                 encoded file.
                 (NB. The SPLibrary must be compiled first)

3) !ReadTemps  - A program which converts the SP's templates into a 'C'
                 source file, which then is compiled and becomes part
                 of the SP code.

4) BuildSP     - A makefile which compiles the SPLibrary.

5) c           - The source code for the SPLibrary and !InitMDisc.

6) h           - Include files for the SPLibrary code.

7) Include     - Contains a single include file, which an application
                 will copy into its own .h directory, then use to call
                 and implement the SP scheme.

8) o           - The directory where objects files are placed after being
                 compiled.
                 (NB. This directory is supplied empty.)

9) SPTemps     - The template definitions for all windows used within the
                 SP code. These are converted into a C source file which
                 has to be compiled into an object module.


(NB. After successful execution of the BuildSP makefile, there will be
another file in this directory: the SPLibrary library module. This library
can then be linked with your own applications.)





How to Build the SP code
-------------------------

This code must be compiled in the correct order to ensure that the correct
code has been built. You should follow the instructions below when
building the SP code.

The basic order is:

  1) Change SPDefs.h for your application.
  2) Change SPTemps templates to suit your needs.
  3) Run !ReadTemps (this creates c.WindDef).
  4) Run BuildSP make file, this builds the SPLibrary.
  5) Add lines of code to call the SPLibrary from your application.
  6) Compile your application, and include the SPLibrary when linked.
  7) Run the !InitMDisc program to create a master disc.
  8) Execute your program. Full Software protection will now be implemeted.



1) Changing SPDefs.h
--------------------

This file contains various variables and constants which are used throughout
the SP code. By changing these variables, no two incarnations of the code will be 
exactly the same, and also no two master disc will be the same.

Follow the text in the SPDefs.h file for information to change.

The values in this file govern the whole protection scheme's code, thus it
would be wise to keep a record of these values you used for each
application, in case you need to reproduce the same code at a later date.
Do not release this information to anybody else, as it is the key information
needed to break the Software Protection for your application.

(NB. You must always re-build the SPLibrary and run !InitMDisc after any
change to this file.)




2) Changing SPTemps
-------------------

Some of the text within the template files can be changed to suit your own
application needs, this usually involves only changing name and address of
your company etc.

You must not alter the design of the templates, the layout or the wording
which is generic to the scheme; this ensures that the end-users of the
scheme have a consistent user interface.




3) Running !ReadTemps
----------------------

This program will convert the SPTemps templates into a C source file which can 
then be compiled. This program is set up to read the templates in the SPcode
directory, and create a file 'WinDef' in the 'SPcode.c' directory.

The program does not need to be compiled before use. If you wish to change
the location and destination of the files, this can be done by changing the
appropriate variable in the !Run file of this application.

(NB. You must always run the 'BuildSP' makefile after running this program
in order that the SPLibrary contains the latest changes to the templates.)
   


4) Running 'BuildSP'
--------------------

This is a simple makefile, which will build the SPLibrary code from all of
its components. You must have created the 'c.WinDef' file before the library
can be built.

This makefile will also build the !RunImage for the !InitMDisc utility, so
that this code also contains all the uptodate code.




5) Adding SP to your code
--------------------------

Follow the information given in the 'Technical Documentation'.
You will need the SP.h file which is supplied in the Include directory.

You can also look at the !SPExample example code to see how the SP code has been
implemented here.




6) Compiling your code
----------------------

Compile your application in the normal way, but when you link it you must
also include the SPLibrary in the link stage.




7) Running !InitMDisc
---------------------

In order that you can test your program with the SP code implemented you will
need to produce a 'master disc' which the application can understand, and
also an encoded file inside your application. The !InitMDisc will do both of
these for you.

Just double click on the !InitMDisc application, and it will attempt to
write the encoded information into your application directory using the
application variable set in SPDefs.h. It will then attempt to produce the
specially formatted master disc for a floppy disc in drive 0.

Ensure that an ADFS E formatted disc is in the drive before you run this
this program.  


If the disc is not formatted with the special sector it will be formatted
for you, however if it is already formatted then only the encoded information
is written to the special sector. The formatting is totally non destructive
so that it is safe to format a disc with information already on it without
corrupting this data.


(NB. A RISC OS 3.0 A300/400, A540, or A3000 system is required to format the
disc initially. However just updating the information can be done on any
Archemedes system.)


This Utility is intended to help you the developer in producing and testing
your protected applications. To ensure that your software is secure this
utility is not released to anybody else. If you really want to be safe, then this 
code may be deleted when you have finished with it. This program is
only suitable for use with your application, so that is impossible to use it
to make master discs of application over which you have no control.

(Warning: Running this application on any other applications master disc
may well destroy that disc as a master disc for that application.)





